
/*
Demo of VQs being drawn using the irrlicht graphics engine.
*/

#include "CVolumetricQuatroidManager.h"
#include <irrlicht.h>
#include "CVolumetricQuatroid.h"
#include "CVQSceneNode.h"
#include <iostream>
#include "CVQTestNode.h"

using namespace MarCore;
using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

using namespace VolumetricQuatroid;

using namespace std;

int main()
{

	IrrlichtDevice *device =
		createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
			false, false, false, 0);

    cout << "created device\n";

	if (!device)
		{return 1;}
    if (device)
    {
        cout << "created device\n";
    };

    device->setWindowCaption(L"MarCore graphics demo");

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();

    //create VolumetricQuatroid object
    CVolumetricQuatroid* vq = new CVolumetricQuatroid();

    //create glu
    CMCGlu* glu = new CMCGlu();

    CVQTestNode *myNode = new CVQTestNode(smgr->getRootSceneNode(), smgr, 666, vq, glu, device);

    myNode->setMaterialFlag(EMF_LIGHTING, true);

	smgr->addCameraSceneNodeFPS();

    smgr->addLightSceneNode(smgr->getRootSceneNode(),
			core::vector3df(0,30,0),
			video::SColorf(1.0f, 1.0f, 1.0f),
			100.0f, -1);

    //IAnimatedMeshSceneNode* gunM = smgr->addAnimatedMeshSceneNode( smgr->getMesh("../../../../../assets/models/shotgun3.x") );

    while( device->run() )
    {

        driver->beginScene( true, true, video::SColor(0,100,100,100) );

        smgr->drawAll();

        driver->endScene();

    };

    device->drop();

    return 0;

};
